package com.chj.chuji.tijie07;

public class PrimTet {
	public static void main(String[] args) {
//		Scanner sc = new Scanner(System.in);
//		while (sc.hasNext()) {
//			int n = sc.nextInt();
//			int t = sc.nextInt();
//			int[] a = new int[n];
//			for (int i = 1; i < n; i++) {
//				a[i] = sc.nextInt();
//			}

		int n = 10;
		int t = 20;
		int[] a2 = new int[] { 6, 3, 4, 5, 7, 7, 8, 6, 9, 2 };

		int[] a = new int[n];
		for (int i = 1; i < n; i++) {
			a[i] = a2[i - 1];
		}

		int index = 1;
		while (true) {
			index = index + a[index];
			if (index == t) {
				System.out.println("YES");
				break;
			}
			if (index > t) {
				System.out.println("NO");
				break;

			}

		}
	}
//	}
}
